import request from '@/utils/request'


export function listPage(params) {
  return request({
    url: '/user/listPage',
    method: 'get',
    params
  })
}

export function save(data) {
  return request({
    url: `/user/add`,
    method: 'post',
    data
  })
}

export function update(data) {
  return request({
    url: `/user/update`,
    method: 'post',
    data
  })
}

export function del(id) {
  return request({
    url: `/user/delete`,
    method: 'delete',
    params: { id: id }
  })
}

export function getById(id) {
  return request({
    url: `/user/getById/${id}`,
    method: 'get',
  })
}

export function relativeRoles(userId) {
  return request({
    url: `/user/relative/${userId}`,
    method: 'get'
  })
}

export function bindingRoles(userId, roleIds) {
  return request({
    url: `/user/binding/${userId}`,
    method: 'post',
    data: roleIds
  })
}
